local S = minetest.get_translator("the_end_game_master")




local function clear_mobs_when_everyone_respawned()
	local dead_players, dead_player_count = limbo_respawning.get_dead_players()
	if dead_player_count == 0
	then
		the_end_game_master.clear_mobs()
	else
		minetest.after(1, clear_mobs_when_everyone_respawned)
	end
end


local function on_lose()
	minetest.chat_send_all(S("The dwarves lost!"))
	
	clear_mobs_when_everyone_respawned()
	
end


minetest.register_on_dieplayer(function()
		local ps, c = 1, 0--limbo_respawning.get_living_players()
		if c == 0
		then
			on_lose()
			the_end_game_master.set_pregame()
			the_end_game_master.increase_game_id()
		end
	end)


